<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="cl"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="ctx" value="<%=request.getContextPath()%>"/>
<link href="${ctx}/css/gj.css" rel="stylesheet">
<body class="homepage">
   <!-- 上传用户头像 -->
	 <div class="modal fade" id="UploadModal" tabindex="-1" role="dialog"
       aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close"
                  data-dismiss="modal" aria-hidden="true">
            &times;
          </button>
          <h4 class="modal-title" id="myModalLabel">
            <img src="${ctx }/favicon/favicon.ico" style="margin-top: -5px;width: 50px;height:50px" />上传用户头像
          </h4>
        </div>
        <br class="modal-body">
        	<div style="margin-left:50px">
        	<form id="uploadavaform" action="${ctx }/commonuser/uploadAvatar.do" method="post" enctype="multipart/form-data">
        		<input type="hidden" name="id" value="${COMMONUSER.id}" />
        		<input type="file" name="avatarfile" label="请选择图片文件"/>
        	</form>
        		<input type="button" id="uploadavatarButton" class="btn btn-default center-block GJBlackbutton" style="width:150px;color:ivory" value="确认上传"/>
        		<img id="ladinggifup" class="center-block" src="${ctx}/img/loading.gif" style="width:25px;height:25px;"/>
        	</div>
          </br>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal -->
    <!-- 上传用户模块 -->
</body>
<script src="${ctx}/js/jquery.js"></script>
<script src="${ctx}/js/url.js"></script>
<script src="${ctx }/js/gt.js"></script>
<script>
	$("#ladinggifup").hide();
	$("#uploadavatarButton").click(function(){
		if($("[name='avatarfile']").val()=="" || $("[name='avatarfile']").val()==null){
			alert("不允许上传空文件");
			return false;
		}else{
			$("#ladinggifup").show();
			$("#uploadavatarButton").hide();
			$("#uploadavaform").submit();
		}
	});
</script>
